package com.fm.base.struct;

public class DoubleLinkedRing<E> {
	private DoubleLinkedNode<E> head = null;
	private DoubleLinkedNode<E> tail = null;
	private int size = 0;

	public void add(E element) {
		if (tail == null) {
			head = tail = new DoubleLinkedNode<>(element, null, null);
			head.setPrev(tail);
			head.setNext(tail);
		} else {
			DoubleLinkedNode<E> temp = new DoubleLinkedNode<>(element, tail, head);
			tail.setNext(temp);
			tail = temp;
		}
		size++;
	}
}
